<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>报修管理</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/css/font.css">
        <link rel="stylesheet" href="/css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script type="text/javascript" src="/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
            <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
            <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]--></head>
    
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form" id="eqptForm">
                	<input type="hidden" id="idhidden" name="id"/>
                    <div class="layui-form-item">
                        <label for="repair_id" class="layui-form-label">
                            <span class="x-red">*</span>报修记录编号</label>
                        <div class="layui-input-inline">
                            <input type="text" readonly="readonly" id="repair_id" name="repairId" autocomplete="off" class="layui-input">
                        </div>

						<label for="mach_pwd" class="layui-form-label">
                        	<span class="x-red">*</span>开机口令
                       	</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mach_pwd" name="machPwd"  autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
			            <label for="prodType" class="layui-form-label"><span class="x-red">*</span>产品类型</label>
			            <div class="layui-input-inline" id="prodType">
					       <div class="layui-input-inline layui-show-xs-block">
				                <select name="prodType" id="prod_type">
				                    <option value="0">产品类型</option>
				                    <option value="1">台式机</option>
				                    <option value="2">笔记本</option>
				                    <option value="3">投影仪</option>
				                    <option value="4">打印机</option>
				                    <option value="5">其他</option>
				                </select>
				            </div>
			            </div>
						
						<label for="vitalInfo" class="layui-form-label"><span class="x-red">*</span>重要资料</label>
			            <div class="layui-input-inline" id="vitalInfo">
					       <div class="layui-input-inline layui-show-xs-block">
				                <select name="vitalInfo" id="vital_info">
				                    <option value="0">重要资料</option>
				                    <option value="1">有</option>
				                    <option value="2">无</option>
				                </select>
				            </div>
			            </div>   
		            </div>
                    <div class="layui-form-item">
                        <label for="mach_brd" class="layui-form-label">
                            <span class="x-red">*</span>机器品牌</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mach_brd" name="machBrd"  autocomplete="off" class="layui-input">
                        </div>
						
						<label for="hdd" class="layui-form-label">HDD</label>
                        <div class="layui-input-inline">
                            <input type="text" id="hdd" name="hdd"  autocomplete="off" class="layui-input">
                        </div>   
                    </div>
                    <div class="layui-form-item">
                        <label for="mach_type" class="layui-form-label">
                            <span class="x-red">*</span>机器型号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mach_type" name="machType" autocomplete="off" class="layui-input">
                        </div>
                        
                        <label for="memory" class="layui-form-label">内存</label>
                        <div class="layui-input-inline">
                            <input type="text" id="memory" name="memory"  autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="serial_numb" class="layui-form-label">系列号</label>
                        <div class="layui-input-inline">
                            <input type="text" id="serial_numb" name="serialNumb" required=""  autocomplete="off" class="layui-input">
                        </div>
                        
						<label for="pamcia" class="layui-form-label">外置PC卡</label>
                        <div class="layui-input-inline">
                            <input type="text" id="pamcia" name="pamcia"  autocomplete="off" class="layui-input">
                        </div>    
                    </div>
                    <div class="layui-form-item">
                        <label for="mis_part" class="layui-form-label">
                            <span class="x-red">*</span>缺少零件</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mis_part" name="misPart" required=""  autocomplete="off" class="layui-input">
                        </div>
                        
                    	<label for="acadapter" class="layui-form-label">AC适配器</label>
                        <div class="layui-input-inline">
                            <input type="text" id="acadapter" name="acadapter" autocomplete="off" class="layui-input">
                        </div>   
                    </div>
                    <div class="layui-form-item">
                        <label for="mach_failure" class="layui-form-label">
                            <span class="x-red">*</span>机器故障现象</label>
                        <div class="layui-input-inline">
                        	<textarea rows="2" class="layui-input" name="machFailure" id="mach_failure"  autocomplete="off"></textarea>
                        </div>
                        
                        <label for="battery" class="layui-form-label">电池</label>
                        <div class="layui-input-inline">
                            <input type="text" id="battery" name="battery" autocomplete="off" class="layui-input">
                        </div>	                       
                    </div>
                    <div class="layui-form-item">
			            <label for="faultType" class="layui-form-label"><span class="x-red">*</span>故障类型</label>
			            <div class="layui-input-inline" id="faultType">
					       <div class="layui-input-inline layui-show-xs-block">
				                <select name="faultType" id="fault_type">
				                    <option value="0">故障类型</option>
				                    <option value="1">固定性故障</option>
				                    <option value="2">间隙性故障</option>
				                </select>
				            </div>
			            </div>
			            
                        <label for="ex_driver" class="layui-form-label">外接光驱</label>
                        <div class="layui-input-inline">
                            <input type="text" id="ex_driver" name="exDriver" autocomplete="off" class="layui-input">
                        </div>			            
		            </div>
		            <div class="layui-form-item">
		            	<label for=mach_appera class="layui-form-label"><span class="x-red">*</span>机器外观检查</label>
                        <div class="layui-input-inline">
                            <input type="text" id="mach_appera" name="machAppera" autocomplete="off" class="layui-input">
                        </div>
                        
                        <label for="other" class="layui-form-label">其他</label>
                        <div class="layui-input-inline">
                        	<textarea rows="2" class="layui-input" name="other" id="other"  autocomplete="off"></textarea>
<!--                             <input type="text" id="other" name="other" autocomplete="off" class="layui-input"> -->
                        </div>                        
                    </div>
               		<div class="layui-form-item">
                        <label for="L_repass" class="layui-form-label"></label>
                        <button class="layui-btn" id="updateBtn">确定修改</button>
                    </div>
                </form>
            </div>

        </div>
        <script>
        	$(function(){
        		//拿到当前页面的链接地址
            	var val = window.location.href;
            	// 拿到链接地址传递的id
            	var id = val.split("?")[1].split("=")[1];
            	if(null == id || undefined == id){
            		alert("系统出错,请重新选择");
            		window.location.go(-1);
            	}
            	$("#idhidden").val(id);
            	$.ajax({
            		type:"get",
            		url:"http://localhost:8080/eqpt/queryEqptById.do",
            		data:{
            			"id":id
            		},
            		dataType:"json",
            		success:function(response){
            			$("#repair_id").val(response.data.repairId);
            			//$("#prodType").val(response.data.prod_type);
            			if(response.data.prod_type!=0){
            				document.getElementById("prod_type")[response.data.prodType].selected=true;
            			}
            			$("#mach_brd").val(response.data.machBrd);
            			$("#mach_type").val(response.data.machType);
            			$("#serial_numb").val(response.data.serialNumb);
            			$("#mis_part").val(response.data.misPart);
            			$("#mach_failure").val(response.data.machFailure);
            			//$("#faultType").val(response.data.fault_type);
            			if(response.data.faultType!=0){
            				document.getElementById("fault_type")[response.data.faultType].selected=true;
            			}
            			$("#mach_appera").val(response.data.machAppera);
            			$("#mach_pwd").val(response.data.machPwd);
            			//$("#vitalInfo").val(response.data.vital_info);
            			if(response.data.vitalInfo!=0){
            				document.getElementById("vital_info")[response.data.vitalInfo].selected=true;
            			}
            			$("#hdd").val(response.data.hdd);
            			$("#memory").val(response.data.memory);
            			$("#pamcia").val(response.data.pamcia);
            			$("#acadapter").val(response.data.acadapter);
            			$("#battery").val(response.data.battery);
            			$("#ex_driver").val(response.data.exDriver);
            			$("#other").val(response.data.other);
            		}
            	})
            	
	     	    //更新数据
	         	$("#updateBtn").click(function(){
	         		$.ajax({
	             		type:"post",
	             		url:"http://localhost:8080/eqpt/updateEqptById.do",
	             		data:$("#eqptForm").serialize(),
	             		dataType:"json",
	             		success:function(response){
	             			//修改成功返回上一级页面
	             			if(response.status==0){
	             				alert("修改成功");
	             				//window.location.href="rec-eqpt-list.html";
	             				window.history.back(-1);
	             			}else{
	             				alert("修改失败,请重试");
	             			}
	             		}
	             	})
	         		return false;
	         	})
        	})
        </script>
        <script>
    	
	      layui.use(['laydate','form'], function(){
	        var laydate = layui.laydate;
	        var  form = layui.form;

	      });

    </script>
    </body>
</html>